#include<bits/stdc++.h>
using namespace std;

string fun(string a) {
    string s = "";
    for (int i = 1; i < a.size(); i++) {
        if (a[i] % 2 == a[i - 1] % 2) {
            s += max(a[i], a[i - 1]);
        }
    }
    return s;
}


signed main() {

    string s, t;
    cin >> s >> t;

    s = fun(s);
    t = fun(t);

    if(s == t)
        cout << s;
    else
        cout << s << "\n" << t;

    return 0;
}

